package com.sakura.probe.common.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class TimeCalculateUtil {

    /**
     * 统计前一天的时间
     * @param interval 时间间隔
     * @return
     */
    public static String beforeTime(int interval){
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
        Date date=new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(Calendar.DAY_OF_MONTH, -interval);
        date = calendar.getTime();
        return sdf.format(date);
    }
}
